package com.zhang.common.lang;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {   //与前端交互的数据打包格式
    private int code;
    private String msg;
    private Object data;

    public static Result succ(Object data){
        return setResult(200,"操作成功",data);
    }
    public static Result fail(String message){
        return setResult(400,message,null);
    }
    public static Result setResult(int code,String msg,Object data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
}

